﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace testing_thing
{
    public class IdentifiableObject
    {
        private List<string> _identifiers;

        public IdentifiableObject(string[] ids)
        {
            for (int i = 0; i < ids.Length; i++)
            {
                ids[i] = ids[i].ToLower();
            }
            _identifiers = new List<string>(ids);
        }

        public bool IdentifiedBy(string id)
        {
            return _identifiers.Contains(id.ToLower());
        }

        protected void AddIdentifier(string[] ids)
        {
            foreach (string id in ids)
            {
                _identifiers.Add(id.ToLower());
            }
        }        

    }

    [TestFixture]
    public class IdentifiableObjectTests
    {
        [Test]
        public void TestBasicOperations()
        {
            IdentifiableObject io = new IdentifiableObject(new string[] {"hello", "World"});
            Assert.IsTrue(io.IdentifiedBy("hello"));
            Assert.IsFalse(io.IdentifiedBy("bye"));
        }

        [Test]
        public void TestCaseSensitivity()
        {
            IdentifiableObject io = new IdentifiableObject (new string[] {"Hello", "World"});
            Assert.IsTrue(io.IdentifiedBy("hello"));
            Assert.IsTrue(io.IdentifiedBy("WOrlD"));
        }
    }
}

